import logging
from lib.wsyffw import wsyffw_flask
from flask import Flask, request

app = Flask(__name__, instance_relative_config = True)

wsyffw_flask.init_all_settings(app)

if __name__ == '__main__':

    from gevent import pywsgi
    from geventwebsocket.handler import WebSocketHandler
    from gevent import monkey

    monkey.patch_all()

    server = pywsgi.WSGIServer(('0.0.0.0', 5501), app, handler_class = WebSocketHandler, log = app.logger)  #
    app.logger.setLevel(logging.DEBUG)
    server.serve_forever()
    # app.run(host = '0.0.0.0', port = 5000, debug = False)

